﻿@model IEnumerable<User>
@{
    string[] ranks = { "tnc-num-topone", "tnc-num-toptwo", "tnc-num-topthree", "tnc-num-topfore" };
 }

<div class="tn-box tn-widget tn-widget-content tn-corner-all spb-pop-attention">
    <div class="tn-box-header tn-widget-header tn-border-gray tn-border-bottom ">
    <h3 class="tn-helper-reset">用户排行</h3>
    </div>
    @if (Model != null && Model.Count() > 0)
    {
        Dictionary<long, long> userThreadCount = ViewData.Get<Dictionary<long, long>>("userThreadCount", null);
      <div class="tn-box-content tn-widget-content tn-corner-bottom ">
        <ul class="tn-person-rank">
        @for (int i = 0; i < Model.Count(); i++)
        {
            var user = Model.ElementAt(i);
            <li class="tn-border-dashed tn-border-gray tn-border-bottom">
                <div class="tnc-list-ranking">
                    @if (i < 3)
                    { 
                        <p class="tnc-blog-num @ranks[i]">
                            <span class="tnc-charts-num">@(i + 1)</span></p>
                    }
                    else
                    { 
                        <p class="tnc-blog-num @ranks[3]">
                            <span class="tnc-charts-num">@(i + 1)</span></p>
                    }
                </div>
                <div class="tnc-list-topic">
                    <div class="tn-avatar-mini">
                        @Html.ShowUserAvatar(user, AvatarSizeType.Micro, true, HyperLinkTarget._blank)
                    </div>
                    @Html.Link(StringUtility.Trim(user.DisplayName, 7), SiteUrls.Instance().Blog(UserIdToUserNameDictionary.GetUserName(user.UserId)), user.DisplayName, new { @class = "tn-user-name" }, HyperLinkTarget._blank)
                </div>
                <p class="tnc-list-number">@userThreadCount[user.UserId]</p>
            </li>
         }
        </ul>
    </div>
    }
</div>
